home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / byte0787.arc / IWPAS.ARC / GRAB.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1987-04-28  |  2.0 KB  |  67 lines

  1. PROGRAM Grab(input,output,picfile);
  2.  
  3. { Copyright (c) 1987, Ciarcia's Circuit Cellar          }
  4. {    All Rights Reserved                                }
  5.  
  6. {$U- control-break checking during execution            }
  7. {$C- control-break checking during I/O operations       }
  8. {$R- array range checking                               }
  9.  
  10. {$Ideclares.p                   declarations            }
  11. {$Ihexutil.p                    hex utilities           }
  12. {$Iserial.p                     serial interface code   }
  13. {$Ipictures.p                   picture file code       }
  14. {$Iimages.p                     image processing        }
  15.  
  16. VAR
  17.  manual : BOOLEAN;              { FALSE when in auto    }
  18.  
  19. BEGIN
  20.  
  21.  LowVideo;
  22.  
  23.  IF (ParamStr(2) = '/n') OR (ParamStr(3) = '/n')
  24.   THEN manual := FALSE
  25.   ELSE manual := TRUE;
  26.  
  27.  ComOn(bitsec);                 { set up serial port    }
  28.  
  29.  Port[comMCR] := $03;           { PC <-> trans serial   }
  30.                                 { camera -> monitor     }
  31.  IF manual
  32.   THEN BEGIN
  33.    Write('Press Enter to grab an image... ');
  34.    Readln;
  35.   END;
  36.  
  37.  pic1 := NIL;                   { ensure new alloc      }
  38.  PicSetup(pic1);                { set up picture array  }
  39.  
  40.  Writeln('Loading');
  41.  GetPicture(pic1,fullres);      { get the byte          }
  42.  
  43.  IF manual
  44.   THEN BEGIN
  45.    Write('Press Enter to display it...');
  46.    Readln;
  47.    SendPicture(pic1);           { show on screen        }
  48.   END;
  49.  
  50.  
  51.  IF (ParamStr(2) = '/c') OR (ParamStr(3) = '/c')
  52.   THEN BEGIN
  53.    pic2 := pic1;                { use compressed image  }
  54.    Writeln('Saving compressed image');
  55.   END
  56.   ELSE BEGIN
  57.    pic2 := NIL;                 { ensure new alloc      }
  58.    PicSetup(pic2);              { get second array      }
  59.    Writeln('Expanding');
  60.    Expand(pic1,pic2);           { expand image          }
  61.   END;
  62.  
  63.  filespec := GetFSpec(ParamStr(1));
  64.  SavePicture(filespec,pic2);    { save it away          }
  65.  
  66. END.
  67.